var $newfeedusers 	= $('#comments'),
	serverUrl	= 'http://localhost/zigo/server/user.php/';
	
NewFeedUser = Backbone.Model.extend({
	
});

NewFeedUserCollection = Backbone.Collection.extend({
	model: NewFeedUser,
	url: serverUrl + 'newfeed/' + document.URL.split('user_id_zing=')[1]
});

NewFeedUserViewItem = Backbone.View.extend({
	tagName: 'div',
	className: 'user-comment',
	initialize: function() {
		this.render = _.bind(this.render, this);
		this.template = _.template($('#comment-item').html());
		//this.model.bind('change', this.render);
	},
	render: function() {
		this.$el.html(this.template(this.model.attributes));
		return this;
	}
});
NewFeedUserList = Backbone.View.extend({
	initialize: function() {
		_(this).bindAll('add');

		this._newfeeds = [];
		
		this.collection.each(this.add);
		
		this.collection.bind('add', this.add);
	},
	render: function() {
		this._rendered = true;
		this.$el.empty();
		_(this._newfeeds).each(function(item) {
			$newfeedusers.append(item.render().el);
		});
	},
	add: function(feed) {
		var newFeedItem = new NewFeedUserViewItem({model: feed});

		this._newfeeds.push(newFeedItem);

		if (this._rendered) {
			this.$el.append(newFeedItem.render().el);
		}
	}
});